ozi: Fix removal of filename extension.
authoroliskoli <oliskoli>
Sun, 29 Jul 2007 19:55:13 +0000 (19:55 +0000)
committeroliskoli <oliskoli>
Sun, 29 Jul 2007 19:55:13 +0000 (19:55 +0000)
ozi.c

diff --git a/ozi.c b/ozi.c
index 4b16981a91bffca94521998160200146f10629fb..514cdcfc73530643d1744bde0d6d8c2dd32f0220 100644 (file)
--- a/ozi.c
+++ b/ozi.c
@@ -114,7 +114,7 @@ ozi_alloc_fsdata(void)
 
 static void
 ozi_openfile(char *fname) {
-    char *c, *tmpname;
+    char *c, *cx, *tmpname;
     char *ozi_extensions[] = {0, "plt", "wpt", "rte"};
     char buff[32];
     
@@ -137,6 +137,8 @@ ozi_openfile(char *fname) {
 
     /* remove extension and add buff + ozi's extension */
     c = strrchr(fname, '.');
+    if (c && (cx = strrchr(fname, '/')) && (cx > c)) c = NULL; 
+    if (c && (cx = strrchr(fname, '\\')) && (cx > c)) c = NULL; 
     if (c == NULL) c = fname + strlen(fname);
     xasprintf(&tmpname, "%*.*s%s.%s", c - fname, c - fname, fname, buff, ozi_extensions[ozi_objective]);